<html>
<head>
<meta charset="utf-8">
<title>有奖竞答</title>
<style>
@font-face{
	font-family:hyrysw; 
	src: url("${rc.contextPath}/font/HYRuiYiSongW.ttf")
}
@font-face{
	font-family:hyykh; 
	src: url("${rc.contextPath}/font/hyykh.ttf")
}
@font-face{
	font-family:fzzhjt; 
	src: url("${rc.contextPath}/font/fzzhjt.ttf")
}
body{
background:url('${rc.contextPath}/images/zhibobg5.png') no-repeat top;
background-color:#000000;
}
.ticket{
 width:100%;
}
.problem {
    width: 50%;
    height: 20%;
    top: 10%;
    left: 8%;
    position: fixed;
    font-family: fzzhjt;
    font-size: 60px;
    color:#fff;
    display:table;
}
.problem span{
	display:table-cell;
	vertical-align:middle; 
	text-indent:120px;
	display:none;
}
.auth {
    width: 80%;
    height: 20%;
    top: 40%;
    left: 15%;
    position: fixed;
    font-family: hyrysw;
    color:#fff;
    font-size: 60px;
}
.code{
	width: 50%;
    height: 10%;
    top: 30%;
    left: 12%;
    position: fixed;
    font-family: Consolas;
    color:#fff;
    font-size: 60px;
}

.code span{
	display:none;
}

.auth span{
	display:none;
}
</style>
<script type="text/javascript" src='${rc.contextPath}/js/jquery-1.7.2.min.js'></script>
</head>
<body>
	<div class="ticket">
		<div class="problem">
			<span id="problem"></span>
		</div>
		<div class="code">
			<span id="codeTitle" style="font-size: 30px;font-family:hyykh;">验证码: </span>
			<span id="code" style="color:red;"></span>
		</div>
		<div class="auth">
			<span id="authTitle" style="font-size: 30px;font-family:hyykh;">中奖人:&nbsp;</span>
			<span id="auth"></span>
		</div>
	</div>


<script type="text/javascript">
	$(document).ready(function() {
		setInterval("getResult()",1000);
	});
	
	var getResultFlag = true;
	function getResult(){
		if (getResultFlag){
			getResultFlag = false;
			$.ajax({
				url : "${rc.contextPath}/admin/draw/ticket/getResult",
		    	dataType : "json",
		    	type:'post',
		    	error:function(){
		    		getResultFlag = true;
		    	},
		    	success:function(json){
		    		if (json.code == 0){
		    			var problem = $("#problem");
		    			var code = $("#code");
		    			var codeTitle = $("#codeTitle");
		    			var auth = $("#auth")
		    			var authTitle = $("#authTitle");
		    			if (problem.html() != json.data.problem){
			    			problem.html(json.data.problem);
		    			}
		    			if (code.html() != json.data.code){
		    				code.html(json.data.code);
		    			}
		    			if (json.data.auth != ""){
		    				var txt = "Lv."+json.data.auth.lv+"&nbsp;"+json.data.auth.name+"&nbsp;<img src='${rc.contextPath}/images/chuizi2.png' />Lv."+json.data.auth.fansLv;
		    				if (auth.html() == ""){
			    				auth.html(txt);
		    				}
		    			} else {
		    				auth.html("");
		    			}
		    			if (problem.html() != "" ){
		    				if (problem.css("display") == "none"){
			    				problem.show(2000);
		    				}
		    			} else {
		    				if (problem.css("display") != "none"){
			    				problem.hide();
			    				
		    				}
		    			}
		    			if (code.html() != "" ){
		    				if (code.css("display") == "none"){
			    				codeTitle.show(500);
			    				code.show(2000);
		    				}
		    			} else {
		    				if (code.css("display") != "none"){
			    				codeTitle.hide();
			    				code.hide();
		    				}
		    			}
		    			if (auth.html() != "" ){
		    				if (auth.css("display") == "none"){
		    					authTitle.show(500);
			    				auth.show(2000);
		    				}
		    			} else {
		    				if (auth.css("display") != "none"){
			    				authTitle.hide();
			    				auth.hide();
		    				}
		    			}
		    		} else {
		    			alert("获取失败: "+json.message);
		    		}
		    		getResultFlag = true;
		    	}
			});
		}
	}
	

</script>

</body>
</html>

